 var RecaptchaOptions = { theme : 'white' };
    	
    	function form_type_display() {
    		disable_all_forms();
    		if (document.getElementById('type').value == 'student') {
    			var className = 'student_form';
    		} else if(document.getElementById('type').value == 'faculty'){
    			var className = 'faculty_form';
    		} else if(document.getElementById('type').value == 'encoder'){
    			var className = 'encoder_form'
    		}
    		
    		<!--get elements by class-->
    		<!--http://stackoverflow.com/questions/3808808/how-to-get-element-by-class-in-javascript-->
    		var elems = document.getElementsByTagName('*'), i;
    		for (i in elems) {
    			if((' ' + elems[i].className + ' ').indexOf(' ' + className + ' ')
    					> -1) {
    				elems[i].style.display = 'table-row';
    				elems[i].required = "true";
    			}
    		}
    	}
    	
    	function disable_all_forms(){
    		var elems = document.getElementsByTagName('*'), i;
    		var form_names = new Array();
    		form_names[0] = 'student_form';
    		form_names[1] = 'faculty_form';
    		form_names[2] = 'encoder_form';
    		for (h in form_names){
    			for (i in elems) {
    				if((' ' + elems[i].className + ' ').indexOf(' ' + form_names[h] + ' ')
    						> -1) {
    					elems[i].style.display = 'none';
    					elems[i].required = "false";
    				}
    			}
    		}
    	}

        function confirm_encoder_subject_delete(){
            if(confirm("Are you sure you want to delete this subject?")){
                return true;
            }
            else return false;
        }
    	
        function addRow(tableID) {
 
            var table = document.getElementById(tableID);
 
            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
 
            //textbox : course_code
            var cell1 = row.insertCell(0);
            var element1 = document.createElement("input");
            element1.type = "text";
            element1.name="course_code";
            element1.placeholder="e.g. CMSC 141";
            cell1.appendChild(element1);

            var cell2 = row.insertCell(1);
            var element2 = document.createElement("select");
            element2.name = "sem_taken";
            cell2.appendChild(element2);
                
                var option = document.createElement('option');
                option.value = '0';
                option.appendChild(document.createTextNode('- Choose semester -'));
                element2.appendChild(option);

                var option = document.createElement('option');
                option.value = '01';
                option.appendChild(document.createTextNode('1st semester'));
                element2.appendChild(option); 

                var option = document.createElement('option');
                option.value = '02';
                option.appendChild(document.createTextNode('2nd semester'));
                element2.appendChild(option); 

                var option = document.createElement('option');
                option.value = '03';
                option.appendChild(document.createTextNode('Summer'));
                element2.appendChild(option); 
 
            var cell3 = row.insertCell(2);
            var element3 = document.createElement("select");
            element3.name = "year_taken";
            cell3.appendChild(element3);

                var option = document.createElement('option');
                option.value = '0';
                option.appendChild(document.createTextNode('- Choose academic year -'));        
                element3.appendChild(option); 
            
                var year = 2013;
                for(var i = year; i>1964; i--){ 
                    var option = document.createElement('option');
                    option.value = i + "-" + (i+1);
                    option.appendChild(document.createTextNode(i + "-" + (i+1)));
                    element3.appendChild(option); 
                }

            var cell4 = row.insertCell(3);
            var element4 = document.createElement("select");
            element4.name = "grades";
            cell4.appendChild(element4);

                var grades = new Array("- Choose grade -","1.00","1.25","1.50","1.75","2.00","2.25","2.50","2.75","3.00","4.00","5.00","DRP","INC");
                for(var i = 0; i<grades.length; i++){ 
                    var option = document.createElement('option');
                    option.value = grades[i];
                    option.appendChild(document.createTextNode(grades[i]));
                    element4.appendChild(option); 
                }

            var cell5 = row.insertCell(4);
            var element5 = document.createElement("select");
            element5.name = "subject_type";
            cell5.appendChild(element5);

                var sub_type = new Array("- Choose subject -","Elective","GE","Major","PE","NSTP","Extra");
                for(var i = 0; i<sub_type.length; i++){ 
                    var option = document.createElement('option');
                    option.value = sub_type[i];
                    option.appendChild(document.createTextNode(sub_type[i]));
                    element5.appendChild(option); 
                }

            var cell6 = row.insertCell(5);
            var element6 = document.createElement("input");
            element6.name = "add_subject";
            element6.value = "Add subject";
            element6.type = "submit";
            element6.class = "sub_button";
            cell6.appendChild(element6);
 
        }